//
//  SecondViewController.m
//  DelegateDemo
//
//  Created by shk on 14/12/10.
//  Copyright (c) 2014年 com.shk. All rights reserved.
//

#import "SecondViewController.h"

@interface SecondViewController ()
{

    UITextField *_textField;
}
@end

@implementation SecondViewController

@synthesize delegateChange=_delegateChange;//


- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor greenColor];
    
    
    _textField = [[UITextField alloc] initWithFrame:CGRectMake(100, 80, 140, 30)];
    _textField.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_textField];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    button.tag = 101;
    button.frame = CGRectMake(100, 150, 140, 40);
    [button setTitle:@"取消" forState:UIControlStateNormal];
    [button addTarget:self action:@selector(closeThisView) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    
    
}


-(void)closeThisView{
    [_delegateChange changLabelText:_textField.text];//调用代理的函数
    [self dismissViewControllerAnimated:YES completion:^{
        
    }];

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
